package 単例模式;

//懒汉式
//双重检查加锁
public class Singleton1 {
	private Singleton1() {
	}

	private static Singleton1 instance;

	public static Singleton1 getInstance() {
		if (instance == null) {
			synchronized (Singleton1.class) {
				if (instance == null) {
					instance = new Singleton1();
				}
			}
		}
		return instance;
	}
}
